// 创建 screeps 配置文件 以及 .secret.json 文件
const fs = require('fs')
const path = require('path')

const configPath = path.resolve(__dirname, '../src/screeps.config.ts')
const secretPath = path.resolve(__dirname, '../.secret.json')

const configContent = `const config: ScreepsConfig = {}

export default config
`
const secretContent = `{
    "main": {
        "token": "你的token",
        "protocol": "https",
        "hostname": "screeps.com",
        "port": 443,
        "path": "/",
        "branch": "default"
    }
}
`

const createFile = (path, content) => {
    // 文件不存在则创建
    if (!fs.existsSync(path)) {
        fs.writeFileSync(path, content)
    } else {
        console.log(`${path} 已存在`)
    }
}

createFile(configPath, configContent)
createFile(secretPath, secretContent)
